const Vue = window.Vue;
const Message = window.ELEMENT.Message
/* 全局配置 element's Message 组件 */
const messageOption = {
  duration: 1000,
  showClose: true
} // message默认配置
const $message = function(option) {
  if (!(option instanceof Object)) {
    option = { message: option }
  }
  Message(Object.assign({}, messageOption, option))
};

['success', 'warning', 'info', 'error'].forEach(type => {
  $message[type] = option => {
    if (!(option instanceof Object)) {
      option = { message: option }
    }
    return Message(Object.assign({}, messageOption, option, { type }))
  }
});

Vue.prototype.$message = $message
